<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑演出计划</title>
  <link rel="stylesheet" href="../../static/css/style.css">
  <script src="/static/script/jquery-1.7.2.js"></script>
  <script>
    $(function () {
      $("#return_scheduleManager").click(function (){
        location = "/scheduleManage";
      });

      if("{{.ConflictFilmName}}" !== "") {
        alert("该时间段已有【{{.ConflictFilmName}}】的演出")
      }

      //获取时间
      var date = $("#schedule_date").value;
      //获取电影名称
      var filmName = $(".film_name").value;
      $("#date_form").attr("action","/toUpdateOrAddSchedulePage?Date="+date+"?filmName="+filmName);
      $("#the_date").value = date;
      if("{{.FilmIsOk}}" === "false" && "{{.NowFilmName}}" !== "") {
        alert("【{{.NowFilmName}}】在 {{.Date}} 并不热映");
      }

    });
  </script>
</head>
<body>
<div id="login_page">
  <div class="logo" style="color: #39987c;">编辑演出计划<span style="float: right">日期：<form method="post" id="date_form"><input type="submit" value="确定" class="date_sub"><input id="schedule_date" class="date" type="date" name="date" value="{{.Date}}"></form></span></div>
  <div id="content_exit">
        <form action="/saveSchedule?scheduleID={{.Schedule.ID}}" method="post" id="exit">
        {{if .Schedule.ID}}
        <table class="exit_table">
          <tr>
            <td>演出厅ID：</td>
            <td><select name="hallID" id="mySelect"/>
              <option value="{{.Schedule.HallID}}">{{.Schedule.HallID}}</option>
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option></td>
            <td>电影名称：</td>
            <td><select name="filmName" class="film_name"/>
              <option class="durations" value="{{.Schedule.FilmName}}">{{.Schedule.FilmName}}</option>
              {{range .Films}}
              <option class="durations" value="{{.FilmName}}" id="{{.Duration}}">{{.FilmName}}（{{.Duration}}min）</option>
              {{else}}
              ┭┮﹏┭┮，没有符合条件的电影
              {{end}}</td>
          </tr>

          <tr>
            <td>售价：</td>
            <td><input type="text" name="price" value="{{.Schedule.Price}}"></td>
            <td>日期：</td>
            <td>
              {{if .FilmIsOk}}
              <input type="date" name="date" value="{{.Schedule.Date}}"/>
              {{else}}
              <input type="date" name="date" value=""/>
              {{end}}
            </td>
          </tr>

          <tr>
            <td>开始时间：</td>
            <td><input type="time" name="startTime" value="{{.Schedule.StartTime}}" class="startTime"/></td>
            <td>结束时间：</td>
            <td><input type="time" name="endTime" value="{{.Schedule.EndTime}}" class="endTime"/></td>
          </tr>
        </table>
        {{else}}
        <table class="exit_table">
          <tr>
            <td>演出厅ID：</td>
            <td><select name="hallID"/>
              <option value="">请选择</option>
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option></td>
            <td>电影名称：</td>
            <td><select name="filmName" class="film_name"/>
              <option value="">请选择</option>
              {{range .Films}}
                <option class="durations" value="{{.FilmName}}">{{.FilmName}}（{{.Duration}}min）</option>
              {{else}}
              ┭┮﹏┭┮，没有符合条件的电影
              {{end}}
            </td>
          </tr>

          <tr>
            <td>售价：</td>
            <td><input type="text" name="price" value=""></td>
            <td>日期：</td>
            <td>
              <input type="date" name="date" value="{{.Date}}" id="the_date"/>
            </td>
          </tr>

          <tr>
            <td>开始时间：</td>
            <td><input type="time" name="startTime" value="" class="startTime"/></td>
            <td>结束时间：</td>
            <td><input type="time" name="endTime" value="" class="endTime"/></td>
          </tr>
        </table>
        {{end}}
        <input type="button" value="返回" id="return_scheduleManager">
        <input type="submit" value="确定" id="add_sub">
      </form>
  </div>
</div>
</body>
</html>